package advanced.network;


import java.net.InetSocketAddress;
import java.net.MalformedURLException;
import java.net.URL;

/**
 * InetAddress 网路ip地址的封装
 * URL  统一资源定位器
 */
public class L_InetSocketAddress {
    public static void main(String[] args) throws MalformedURLException {
        InetSocketAddress isa = new InetSocketAddress("192.168.1.1", 80);
        System.out.println(isa.getAddress());
        System.out.println(isa.getPort());
        System.out.println(isa.getHostName());
        System.out.println("-------------------");
        URL url = new URL("http://www.baidu.com:80/index.html?uname=shsxt&age=19#a");
        //获取四个值
        System.out.println("协议" + url.getProtocol());
        System.out.println(" 域名:" + url.getHost());
        System.out.println("端口:" + url.getPort());
        System.out.println("请求资源1 :" + url.getFile());
        System.out.println("请求资源2 :" + url.getPath());


    }
}
